<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets">
	<h:head>
		<title>Edit Schedule</title>
		<h:outputStylesheet library="css" name="main.css" />
	</h:head>
	<h:body>
	
		<!-- editSchedule page only visible to logged-in users -->
		<h:panelGroup rendered="#{credentials.isLoggedIn()}">
		
			<ui:insert name="header" >
		  		<ui:include src="/templates/header.xhtml" />
			</ui:insert>
		
			<h:form>
				<h:panelGrid columns="6" rows="2">
					<h:panelGrid rows="2">
						<h:panelGrid>
							<h:outputText value="Employee Number:"></h:outputText>
						</h:panelGrid>
						<h:panelGrid>
							<h:outputText value="Name:"></h:outputText>
						</h:panelGrid>
					</h:panelGrid>
					
					<h:panelGrid rows="2" style=" width : 163px;">
						<h:panelGroup>
							<h:outputText value="#{credentials.getEmployeeNumberAsString()}"></h:outputText>
						</h:panelGroup>
						<h:panelGroup>
							<h:outputText value="#{credentials.firstName} #{credentials.lastName}"></h:outputText>
						</h:panelGroup>
					</h:panelGrid>
	
	
					<h:panelGrid>
						<h:outputText value="Week Number" />
					</h:panelGrid>
					<h:panelGrid style="height : 26px; width : 70px;">
						<h:outputText value="#{scheduler.getWeekNum()}" />
					</h:panelGrid>
	
					<h:panelGrid>
						<h:outputText value="Week Ending: " />
					</h:panelGrid>
					<h:panelGrid>
						<h:outputText value="12/12/2012"/>
					</h:panelGrid>
				</h:panelGrid>
				
				<h:dataTable id="table1"  value="#{scheduler.timeSheets}" var="itimeSheet" border="1">
					<h:column>
						<f:facet name="header">
							<h:outputText value="#{msgs.projectheading}" />
						</f:facet>
						<h:inputText value="#{itimeSheet.project}"></h:inputText>
						<f:facet name="footer">					
							<h:outputText value="#{msgs.total}" style="font-weight:bold"/>
						</f:facet>
					</h:column>				
					<h:column>
						<f:facet name="header">
							<h:outputText value="#{msgs.wp}" />
						</f:facet>
						<h:inputText value="#{itimeSheet.wp}"></h:inputText>
					</h:column>
					<h:column>
						<f:facet name="header">
							<h:outputText value="#{msgs.total}"/>
						</f:facet>
						<h:outputText value="#{itimeSheet.total}"></h:outputText>
						<f:facet name="footer">	
							<h:outputText value="#{scheduler.columnTotal}" style="width : 147px;"/>
						</f:facet>
					</h:column>
					<h:column>
						<f:facet name="header">
							<h:outputText value="#{msgs.sat}" />
						</f:facet>					
						<h:inputText value="#{itimeSheet.sat}"></h:inputText>
						<f:facet name="footer">	
							<h:outputText value="#{scheduler.satTotal}" style=" width : 147px;"/>
						</f:facet>
					</h:column>
					<h:column>
						<f:facet name="header">
							<h:outputText value="#{msgs.sun}" />
						</f:facet>
						<h:inputText value="#{itimeSheet.sun}"></h:inputText>
						<f:facet name="footer">	
							<h:outputText value="#{scheduler.sunTotal}" style=" width : 147px;"/>
						</f:facet>
					</h:column>
					<h:column>
						<f:facet name="header">
							<h:outputText value="#{msgs.mon}" />
						</f:facet>
						<h:inputText value="#{itimeSheet.mon}"></h:inputText>
						<f:facet name="footer">	
							<h:outputText value="#{scheduler.monTotal}" style=" width : 147px;"/>
						</f:facet>
					</h:column>
					<h:column>
						<f:facet name="header">
							<h:outputText value="#{msgs.tue}" />
						</f:facet>
						<h:inputText value="#{itimeSheet.tue}"></h:inputText>
						<f:facet name="footer">	
							<h:outputText value="#{loginSession.scheduler.tueTotal}" style=" width : 147px;"/>
						</f:facet>
					</h:column>
					<h:column>
						<f:facet name="header">
							<h:outputText value="#{msgs.wed}" />
						</f:facet>
						<h:inputText value="#{itimeSheet.wed}"></h:inputText>
						<f:facet name="footer">	
							<h:outputText value="#{scheduler.wedTotal}" style=" width : 147px;"/>
						</f:facet>
					</h:column>
					<h:column>
						<f:facet name="header">
							<h:outputText value="#{msgs.thu}" />
						</f:facet>
						<h:inputText value="#{itimeSheet.thu}"></h:inputText>
						<f:facet name="footer">	
							<h:outputText value="#{scheduler.thuTotal}" style=" width : 147px;"/>
						</f:facet>
					</h:column>
					<h:column>
						<f:facet name="header">
							<h:outputText value="#{msgs.fri}" />
						</f:facet>
						<h:inputText value="#{itimeSheet.fri}"></h:inputText>
						<f:facet name="footer">	
							<h:outputText value="#{scheduler.friTotal}" style=" width : 147px;"/>
						</f:facet>
					</h:column>
					<h:column>
						<f:facet name="header">
							<h:outputText value="#{msgs.notes}" />
						</f:facet>
						<h:inputText value="#{itimeSheet.notes}"></h:inputText>
					</h:column>
				</h:dataTable>
				<h:commandButton value="#{msgs.save}" action="#{scheduler.save}"></h:commandButton>
				<h:commandButton value="#{msgs.addrow}" action="#{scheduler.addRow}"></h:commandButton>			
				<h:commandButton value="#{msgs.delete}" action="#{scheduler.deleteRow}"></h:commandButton>
				<h:commandButton value="#{msgs.nextweek}" action="#{scheduler.nextWeek}"></h:commandButton>
			</h:form>
		</h:panelGroup>
		
		<!-- Not logged-in viewers will be able to view this section -->
		<h:panelGroup rendered="#{!credentials.isLoggedIn()}">
			<ui:insert name="notLogIn" >
		  		<ui:include src="/templates/notLogIn.xhtml" />
			</ui:insert>
		</h:panelGroup>
		
	</h:body>
</html>
